package com.zmn.brs.services.impl.objective.event;

import com.zmn.brs.model.entity.objective.event.ObjectiveEvent;
import com.zmn.brs.model.entity.objective.event.ObjectiveEventQuery;
import com.zmn.brs.persistence.interfaces.objective.event.ObjectiveEventDao;
import com.zmn.brs.services.interfaces.objective.event.ObjectiveEventService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ObjectiveEventServiceImpl implements ObjectiveEventService {

    @Resource
    ObjectiveEventDao objectiveEventDao;

    @Override
    public ObjectiveEvent findByKey(Integer objEventId) {
        return objectiveEventDao.findByKey(objEventId);
    }

    /**
     * 根据事件ID查询
     * @param eventId ID
     * @return
     */
    @Override
    public ObjectiveEvent findByEventId(Integer eventId){
        return objectiveEventDao.findByEventId(eventId);
    }

    /**
     * 查询
     * @param eventCode 事件编码
     * @return
     */
    @Override
    public ObjectiveEvent findByEventCode(Integer eventCode) {
        return objectiveEventDao.findByEventCode(eventCode);
    }

    @Override
    public List<ObjectiveEvent> listPageByQuery(ObjectiveEventQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return objectiveEventDao.listPageByQuery(query);
    }

    @Override
    public List<ObjectiveEvent> listByQuery(ObjectiveEventQuery query) {
        return objectiveEventDao.listByQuery(query);
    }

    @Override
    public List<ObjectiveEvent> listAll() {
        return objectiveEventDao.listAll();
    }

    @Override
    public Integer countByQuery(ObjectiveEventQuery query) {
        return objectiveEventDao.countByQuery(query);
    }
    @Override
    public Integer updateByKey(ObjectiveEvent objectiveEvent) {
        return objectiveEventDao.updateByKey(objectiveEvent);
    }

    @Override
    public Integer insert(ObjectiveEvent objectiveEvent) {
        return objectiveEventDao.insert(objectiveEvent);
    }

    @Override
    public Integer deleteByKey(Integer objEventId) {
        return objectiveEventDao.deleteByKey(objEventId);
    }

}